package WaiBao;

import java.util.Arrays;

public class LiFanRong {
    public static void main(String[] args) {
        String[] name = {"同学1(班长)", "同学2(副班长)", "同学3(纪律委员)", "同学4(体育委员)", "同学5", "同学6", "同学7", "同学8", "同学9", "同学10", "同学11",
                "同学12", "同学13", "同学14", "同学15", "同学16", "同学17", "同学18", "同学19", "同学20", "同学21", "同学22", "同学23", "同学24", "同学25", "同学26", "同学27",
                "同学28", "同学29小李(学习委员)","同学30栗樊榕(宣传委员)"};//最后一位考生本人:栗樊榕(宣传委员) 21生科三班  210710011314
        int[] age = {18, 19, 20, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁

        double[]  rongyao1 = {94, 84, 93, 84, 91, 84, 77, 79, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[]  rongyao2 = {74, 94, 85, 74, 96, 91, 71, 84, 94, 77, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[]  rongyao3 = {73, 94, 90, 91, 74, 69, 76, 77, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 95};

        double kule;//代表每个学生的总分
        double xuebui;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            kule = (rongyao1)[i] + rongyao2[i] +rongyao3[i];
//            xuebui  = (  kule * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +  kule);
//            System.out.println(name[i] + "的平均分为:" +  xuebui);
//        }



        double leon = 0, duode = 0;
        double[] teel = new double[30];
//        for (int i = 0; i < 30; i++) {
//            leon = rongyao1[i] +  rongyao2[i] + rongyao3[i];
//            duode = (leon * 1.0) / 3;
//            teel[i] = duode ;
//        }
//
//        for (int i = 0; i <teel.length - 1; i++) {
//            for (int j = 0; j < teel.length - i - 1; j++) {
//                if (teel[j] < teel[j + 1]) {
//                    double tep = teel[j];
//                    teel[j] =teel[j + 1];
//                    teel[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(teel[i]);
//        }




        double hck1 = 0, hck2 = 0, hck3 = 0;//计算每门课的平均分
        double boom1 = 0,boom2 = 0 ,boom3 = 0;//计算每门课标准差
        double hog1 = 0,hog2 = 0, hog3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < rongyao1.length; i++) {
            sum2+=rongyao1[i];
        }
        hck1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+hck1);
        double Sum = 0;
        for (int i = 0; i < rongyao2.length; i++) {
            Sum+=rongyao2[i];
        }
        hck2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+hck2);
        double sum = 0;
        for (int i = 0; i <rongyao3.length; i++) {
            sum+=rongyao3[i];
        }
        hck3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ hck3);


//////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <rongyao1.length; i++) {
            c1+= (rongyao1[i] - hck1)*(rongyao1[i] - hck1);
        }
        boom1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ boom1);

        for (int i = 0; i <rongyao2.length; i++) {
            c2+= (rongyao2[i] - hck2)*(rongyao2[i] -hck2);
        }
        boom2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+ boom2);

        for (int i = 0; i < rongyao3.length; i++) {
            c3+= (rongyao3[i] -hck3)*(rongyao3[i] -  hck3);
        }
        boom3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+ boom3);
////////////
//////////////
//        Arrays.sort(rongyao1);
//        Arrays.sort(rongyao2);
//        Arrays.sort(rongyao3);
//        hog1 =(rongyao1[14]+rongyao1[15])*1.0/2;
//        hog2 =(rongyao2[14]+rongyao2[15])*1.0/2;
//        hog3 =( rongyao3[14]+rongyao3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+hog1);
//        System.out.println("微生物学的中位数为:"+hog2);
//        System.out.println("人体组织解剖学的中位数为:"+hog3);




    }
}
